<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!DOCTYPE HTML>
<html>
<head>
    <base href="${ctx }/">
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <link rel="stylesheet" href="plugin/bootstrap-3.3.7-dist/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="css/bootstrap-datetimepicker.css"/>
    <link rel="stylesheet" href="plugin/bootstrap-table/dist/bootstrap-table.css">
    <!-- <link rel="stylesheet" href="css/zoom.css" media="all" />  -->
    <link rel="stylesheet" href="alert/alert.css">
</head>
<body>

        <div>
            <ul class="breadcrumb">
                <li>
                    <i class="icon-home home-icon"></i>
                    <a href="javascript:void(0)"> Finance Management(财务管理)</a>
                </li>
                <li class="active">
                    <a href="view/finance/monthorder.jsp">Monthly settlement order(月结算订单)</a>
                </li>
            </ul>
        </div>
  <div class="container-fluid">
    <div class="container row" id="query">
        <div>
            <div class="form-inline" role="form" method="post" id="queryForm">
                <div class="form-group">
                    <label>Time(时间):</label>
                    <input type="text" class="form-control input-append form_date" id="month">
                </div>
                <div class="form-group">
                    <label>Name(名称):</label>
                    <input type="text" id="driverName" class="form-control">
                </div>
                <div class="form-group">
                    <label>Phone(电话):</label>
                    <input type="text" id="settlement" class="form-control">
                </div>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <button id="queryBtn" onclick="doQuery1('demo-table',queryParams1())" class="btn btn-primary">Search
                </button>
            </div>
        </div>
        <br>
    </div>

    <table id="demo-table"></table>
</div>
</body>

<!-- 加载需要的js -->
<script src="js/jquery-3.2.1.min.js"></script>
<script src="plugin/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script src="js/jquery-bootstrap-pagination.js"></script>
<script src="plugin/bootstrap-table/dist/bootstrap-table.min.js"></script>
<script src="plugin/bootstrap-table/dist/locale/bootstrap-table-zh-CN.min.js"></script>
<script src='alert/alert.js'></script>
<!--时间  -->
<script src="js/bootstrap-datetimepicker.js"></script>
<script src="js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="js/common.js"></script>
<script src="plugin/layer/layer.js"></script>
<script type="text/javascript" charset="utf-8">
    var M = {}

    $('.form_date').datetimepicker({
        minView: "month", //选择日期后，不会再跳转去选择时分秒
        language: 'zh-CN',
        format: 'mm/yyyy',
        todayBtn: 1,
        autoclose: 1,
    });

    $(function () {
        initPath("${ctx }");
        initTable('demo-table', queryParams, columns, "finance/month/orders");
    });

    var columns = [{field: '', title: 'Choose', checkbox: true},
        {
            field: 'driverName',
            title: 'Driver Name(司机名称)',
            align: 'center',
            valign: 'middle'
        },
        {
            field: 'telephone',
            title: 'Driver Phone(司机电话)',
            align: 'center',
            valign: 'middle',
            formatter: function (value, row, index) {
            	return "04"+value;
            }
        },
        {
            field: 'total_service_time',
            title: 'Service Time(服务时间)',
            align: 'center',
            valign: 'middle',
            formatter: ''
        },
        {
            field: 'turnover',
            title: 'Total Revenue(营业总额)',
            align: 'center',
            valign: 'middle'
        },
        {
            field: 'contributionAmount',
            title: 'fab Commissions(平台收取)',
            align: 'center',
            valign: 'middle'
        },
        {
            field: 'contributionAmount',
            title: 'Total(总额)',
            align: 'center',
            valign: 'middle'
        },
        {
            field: 'roadPrice',
            title: 'Toll(过路费)',
            align: 'center',
            valign: 'middle'
        },
        {
            field: 'cleanness',
            title: 'Cleaning Fees(清洁费)',
            align: 'center',
            valign: 'middle'
        },
        {
            field: 'tip',
            title: 'Tips(小费)',
            align: 'center',
            valign: 'middle'
        },
        {
            field: 'order_num',
            title: 'orders(订单量)',
            align: 'center',
            valign: 'middle'
        },
        {
            field: 'month',
            title: 'Settlement in(月份)',
            align: 'center',
            valign: 'middle',
            formatter: function (value, row, index) {
            var va=	value.split("-");
            	return va[0]+"-"+va[1];
            }
        },
        {
            field: 'id',
            title: 'Operation(操作)',
            align: 'center',
            valign: 'middle',
            formatter: function (value, row, index) {
                var str = '<a class="btn btn-info" href="view/finance/monthinfo.jsp?month='+row.month+'&driverId='+row.uid+'">Details</a>';
                return str;
            }
        }
    ];

    function queryParams(params) {
        var param = {
            settlement: $('#settlement').val(),
            months: $('#month').val(),
            driverName: $('#driverName').val(),
            pageNo: this.pageNumber,
            pageSize: this.pageSize
        }
        return param;
    }

    function queryParams1() {
        var param = {
            settlement: $('#settlement').val(),
            months: $('#month').val(),
            driverName: $('#driverName').val(),
            pageNo: 1,
            pageSize: this.pageSize
        }
        return param;
    }

//    function changeStatus(id,isDeleted,current) {
//        $.post(
//            "user/update",
//            {id:id,isDeleted:isDeleted},
//            function (json) {
//                if(json.code == 200){
//                    M.dialog2 = jqueryAlert({
//                        'title': '温馨提示',
//                        'content': '<p>操作成功</p>',
//                        'width': "320",
//                        'modal': true,
//                        'buttons': {
//                            '确定': function () {
//                                M.dialog2.close();
//                            }
//                        }
//                    });
//                    if(isDeleted == 0){
//                        $(current).attr("class","btn btn-danger");
//                        $(current).attr("onclick","changeStatus("+id+",1,this)");
//                        $(current).parent().prev().text("启用");
//                        $(current).text("禁用");
//                    }else{
//                        $(current).attr("class","btn btn-info");
//                        $(current).attr("onclick","changeStatus("+id+",0,this)");
//                        $(current).parent().prev().text("禁用");
//                        $(current).text("启用");
//                    }
//                }else{
//                    M.dialog2 = jqueryAlert({
//                        'title': '温馨提示',
//                        'content': '<p>系统繁忙，请稍后重试</p>',
//                        'width': "320",
//                        'modal': true,
//                        'buttons': {
//                            '确定': function () {
//                                M.dialog2.close();
//                            }
//                        }
//                    });
//                }
//                if (M.dialog2) {
//                    return M.dialog2.show();
//                }
//            }
//        )
//    }
</script>
</html>


